package com.inepex.inechart.client;

import com.inepex.inechart.client.misc.HasShadow;
import com.inepex.inechart.client.misc.HasZIndex;
import com.inepex.inechart.shared.data.AbstractDataSet;
import com.inepex.inechart.shared.properties.Color;

public abstract class GraphicalChartComponent implements HasZIndex, HasShadow, Comparable<GraphicalChartComponent>{

	// comparison helper fields
	private static int highestComparableNo = 0;
	private int comparableNo;

	// shadow
	protected Color shadowColor;
	protected double shadowOffsetX, shadowOffsetY;
	protected boolean hasShadow;

	protected int zIndex;
	
	protected boolean visible;
	
	protected AbstractDataSet dataSet;

	protected GraphicalChartComponent(){
		comparableNo = highestComparableNo++;
		setShadowOffsetY(Defaults.shadowOffsetX);
		setShadowOffsetX(Defaults.shadowOffsetY);
		setShadowColor(Defaults.shadowColor());
		hasShadow = true;
		visible = true;
		zIndex = Integer.MIN_VALUE;
	}

	@Override
	public void setShadowOffsetX(double offsetX) {
		this.shadowOffsetX = offsetX;
	}

	@Override
	public void setShadowOffsetY(double offsetY) {
		this.shadowOffsetY = offsetY;
	}

	@Override
	public double getShadowOffsetX() {
		return shadowOffsetX;
	}

	@Override
	public double getShadowOffsetY() {
		return shadowOffsetY;
	}

	@Override
	public void setZIndex(int zIndex) {
		this.zIndex = zIndex;
	}

	@Override
	public int getZIndex() {
		return this.zIndex;
	}

	@Override
	public Color getShadowColor() {
		return shadowColor;
	}

	@Override
	public void setShadowColor(Color shadowColor) {
		this.shadowColor = shadowColor;
	}

	public boolean isHasShadow() {
		return hasShadow;
	}

	public void setHasShadow(boolean hasShadow) {
		this.hasShadow = hasShadow;
	}

	@Override
	public int compareTo(GraphicalChartComponent o) {
		return comparableNo - o.comparableNo;
	}

}
